import { createRouter, createWebHistory } from 'vue-router'
import Index from '@/views/index.vue'
import createGuard from '@/router/permission'

const title = '举个爪爪'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      meta: { title: title },
      path: '/',
      name: 'home',
      component: Index,
      children: [
        {
          meta: { title: '首页 | ' + title + '🏠' },
          name: 'MainHome',
          path: '',
          component: () => import('@/views/Home/index.vue'),
        },
        {
          meta: { title: '登录 | ' + title + '🙈' },
          name: 'login',
          path: '/login',
          component: () => import('@/views/Login/index.vue'),
        },
        {
          meta: { title: '聊天 | ' + title + '💬' },
          name: 'chat',
          path: '/chat',
          component: () => import('@/views/Chat/index.vue'),
          children: [
            {
              meta: { title: '消息 | ' + title + '💬' },
              name: 'ChatMessage',
              path: '',
              component: () => import('@/views/Chat/Message/index.vue'),
            },
            {
              meta: { title: '联系人 | ' + title + '💬' },
              name: 'Contact',
              path: '/chat/contact',
              component: () => import('@/views/Chat/Contact/index.vue'),
            },
            {
              meta: { title: '朋友圈 | ' + title + '💬' },
              name: 'WechatMoment',
              path: '/chat/wechatMoment',
              component: () => import('@/views/Chat/WechatMoment/index.vue'),
            },
            {
              meta: { title: '设置 | ' + title + '⚙️' },
              name: 'Setting',
              path: '/chat/setting',
              component: () => import('@/views/Chat/Setting/index.vue'),
            },
          ],
        },
      ],
    },
  ],
})
createGuard(router)
export default router
